

let dirArr = new Array()
const dirTree = (parent, child) => {
    let nextLev = new Array()
    for (let i = 0; i < child.length; i++) {
        if (child[i].PARENT == parent.DIRID) {
            dirTree(child[i], child) //递归出子元素
            nextLev.push(child[i])
        }
        if (nextLev.length > 0) {
            parent.nextLev = nextLev
        }
    }
    return parent
}

export const pdt = (data) => {
    dirArr = [] //初始化数组
    for (let k = 0; k < data.length; k++) {
        if (data[k].PARENT == null) { //获取父元素
            let o = dirTree(data[k], data)
            dirArr.push(o)
        }
    }
    // console.log(dirArr)    
    return dirArr
}
            